UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jTnEY1lKJphXVRscBHF4Eb6y7m79aQIy9bf/vZwqVQE='
WHERE
key_id = 'f4ca6e6323362387e478cae543ed5512dc96ff14f10276f869b7fa9835e095cb'
AND (
token = 'jTnEY1lKJphXVRscBHF4Eb6y7m79aQIy9bf/vZwqVQE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)