UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MHCjSfum41GEB9ugaw7km39bp6QdegsQ8z6DnqodDKs='
WHERE
key_id = 'ed317b0086e52fb98a029656918107599409ef86e98f8eb08f2295ee7221c999'
AND (
token = 'MHCjSfum41GEB9ugaw7km39bp6QdegsQ8z6DnqodDKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)