UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X2SdKbBMQipNvrS1vbOpjl3YAC3X/F+iz594ibFxksw='
WHERE
key_id = '7c446df95ba9dd05ea8e32702131ebe7d074a7627ab4115b9a97cd1f80120908'
AND (
token = 'X2SdKbBMQipNvrS1vbOpjl3YAC3X/F+iz594ibFxksw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)