UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8CuiNE7nrrNK/TGLz3u4P3tRgofcp9FJ+9bnKwUuzAk='
WHERE
key_id = 'c1e5f8577690cdfb2664d3fbd577ec0309452077f928def061397c6457258d14'
AND (
token = '8CuiNE7nrrNK/TGLz3u4P3tRgofcp9FJ+9bnKwUuzAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)