UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nnZuhb9zNL7TRtq7MehG4hWxYe0ym/9zveMBVj+8myY='
WHERE
key_id = 'b1e1618bc294d83c91424c639486e1734547ac262cc2b2c8ae839a3c73fe4dae'
AND (
token = 'nnZuhb9zNL7TRtq7MehG4hWxYe0ym/9zveMBVj+8myY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)