UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KU1povyHcux4WBX+Hu7micsZ13HVTLXA0lqRqMOI1Qk='
WHERE
key_id = 'b881d640e29946d40a6a607f795dd9cd18799a1296bff2d77a7691e07da29174'
AND (
token = 'KU1povyHcux4WBX+Hu7micsZ13HVTLXA0lqRqMOI1Qk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)