UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qBjp1aNpCsdv77VGS9w7nyHl63Invcl7raeJnxF90t4='
WHERE
key_id = '1a793880eb6ab21c8e433ee029eb246d1cc33f436a8922998f56cf29719058bc'
AND (
token = 'qBjp1aNpCsdv77VGS9w7nyHl63Invcl7raeJnxF90t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)