UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sw8yvXfMX0UVJkw5tkwsObbhcW75uDGl2RjtK/c4Q74='
WHERE
key_id = 'b466d665ea6b4c0e12954e4d7b723d64cf20e3e517c76a1755fe19c0fcbbeb9b'
AND (
token = 'sw8yvXfMX0UVJkw5tkwsObbhcW75uDGl2RjtK/c4Q74='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)