UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2GvgeKi7E+AGDtauOjIH3Hjs/V9xFENqmCL0se6QiKg='
WHERE
key_id = '8d7bf509812c6c83311fc9dcd42b554d5882d6c25f0282d1f71df6449d69517f'
AND (
token = '2GvgeKi7E+AGDtauOjIH3Hjs/V9xFENqmCL0se6QiKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)