UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oK1e5DrTywW3kMLvBP+zwaOyejhMt2TtJRFUL/QbnYI='
WHERE
key_id = 'f65359f96feb6c9b0234010389dedf0339fae1ec5134937ba0c451937b7a4bd1'
AND (
token = 'oK1e5DrTywW3kMLvBP+zwaOyejhMt2TtJRFUL/QbnYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)