UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '85+5jItM8gUlgAZyqwuLX3N1yRy2tBCbg8veACxkLb8=' 
WHERE 
  key_id = '0069607f116f9de1d1ff5becc9eba199cedc0717a2d4c59abc28df055a360b10' 
  AND (
    token = '85+5jItM8gUlgAZyqwuLX3N1yRy2tBCbg8veACxkLb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019