UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bXy23FVdcAYEcCgaMqCyJwwT93EutHuwbyi6FniD3TE='
WHERE
key_id = '9d2f732481f21df22d72747beccf23c8b7a61ddfc72c5287e9f2c648bad1e2fd'
AND (
token = 'bXy23FVdcAYEcCgaMqCyJwwT93EutHuwbyi6FniD3TE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)