UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wa8vn1LCi0AE6JldY1RitKT/IV8Ez73CmiKBvWt7xZk='
WHERE
key_id = '3ac0041e411bb5f23744b3a0cc09c78ac12b9a6999c960d7f169e3af723f8f7b'
AND (
token = 'wa8vn1LCi0AE6JldY1RitKT/IV8Ez73CmiKBvWt7xZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)