UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BzjAefIQSC4s4u5BxNhH+ypcnIPM/ktTZPma6WgVOkM='
WHERE
key_id = 'ff644329a5b8e45732365ea0adca3f72f068c2a9de09b8d76a960db147cfd4a6'
AND (
token = 'BzjAefIQSC4s4u5BxNhH+ypcnIPM/ktTZPma6WgVOkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)