UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HLJwEdVLYRWko+x10Cs6y2jyzwS6NxFUK47wEsI0Ozo='
WHERE
key_id = 'b6ef118e82dc34acc70ee7c4d8165017fc42dc556944f97385dd623b9ced80a5'
AND (
token = 'HLJwEdVLYRWko+x10Cs6y2jyzwS6NxFUK47wEsI0Ozo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)