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

Query time 0.00028