UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O+NMk5gnrmUNjyRg9fWlSMb9zVk6qlN0T6jAC/B4w30='
WHERE
key_id = '3f382a952b36512b458df1541e9b327fb0a872048ed6d26962614d076391577b'
AND (
token = 'O+NMk5gnrmUNjyRg9fWlSMb9zVk6qlN0T6jAC/B4w30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)