UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F0SYChVgLABZAy1CCR6i8L05hwTvbV3EAVIEIUS6Ecc='
WHERE
key_id = '7af37e84e4f415b5d5d4639d063f047162ef9a3173c354a0eb204c2286c63ddc'
AND (
token = 'F0SYChVgLABZAy1CCR6i8L05hwTvbV3EAVIEIUS6Ecc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)