UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OhTi7WQ5qHYUW8czLNMATU0IUxddHNT1ytRfF0+E8lE='
WHERE
key_id = 'c12e39bc202e7a0ee4a89530f20e262e33f07528ef66b85912c3485a0d09fcb7'
AND (
token = 'OhTi7WQ5qHYUW8czLNMATU0IUxddHNT1ytRfF0+E8lE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)