UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uW2yhEdigfEClbl0sXkcnTkAX3gWQRvijqoPsOyrNxo='
WHERE
key_id = 'cdaa75d1903ebe5b9d99b2070826625a9941ce5cb4034a5d06245874b5dc095c'
AND (
token = 'uW2yhEdigfEClbl0sXkcnTkAX3gWQRvijqoPsOyrNxo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)