UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oIQgm8/GRkFPtO8lFF2xyjjNquY8v0Nz8o+ETMXvTEQ='
WHERE
key_id = '396b46f300b0c4e37259a7cdba1e8a2c5b39d85bc908e285f26655090f0f5ead'
AND (
token = 'oIQgm8/GRkFPtO8lFF2xyjjNquY8v0Nz8o+ETMXvTEQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)