UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dFFj4nmxErSi0xo6g3VQLniwyykxdqyYssR7KR5W1WQ='
WHERE
key_id = '4d24e8f8abfa7f63df45b319966e0875a29a1394703f90dd0678f2efe424cd8c'
AND (
token = 'dFFj4nmxErSi0xo6g3VQLniwyykxdqyYssR7KR5W1WQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)