UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xFOTXAdEkdjxS6Sx2QEA0ULpa8a69S8zlzGYd8s5FP8='
WHERE
key_id = '8c54522c2359b5c63cebc96414343c6bd0d10333593d2979b460937eecc31c0e'
AND (
token = 'xFOTXAdEkdjxS6Sx2QEA0ULpa8a69S8zlzGYd8s5FP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)