UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I+2rFJBP5/pP8G5TXgeL8Lnhr8G1KmhHpCXYs95arG0='
WHERE
key_id = 'ddef0c0834ed46b9f3c3599de30669c70e4980526ba6ecd3e9215016c7d7d67a'
AND (
token = 'I+2rFJBP5/pP8G5TXgeL8Lnhr8G1KmhHpCXYs95arG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)