UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G9njEopZKtQ/bZ6c+PgG2quUFLNh50X4w40j95ke7pY='
WHERE
key_id = 'd14e36a876b52bc49cf400743762f4706aede636e26ce453213d3cb121d7a7c4'
AND (
token = 'G9njEopZKtQ/bZ6c+PgG2quUFLNh50X4w40j95ke7pY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)