UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b/Qmy1rqNvXj/UJhWms2K0HofdPffYypUEiD1bS96zs=' 
WHERE 
  key_id = '3b1195d0804709e20986a09c550cf3ae723acd28b5025856d6c92782d6e12eae' 
  AND (
    token = 'b/Qmy1rqNvXj/UJhWms2K0HofdPffYypUEiD1bS96zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028