UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9tG6Kywcdym3U3PfeExrw7G9zE+vofzf31enyYvwM18=' 
WHERE 
  key_id = '064bcc08547b673fc249a0c671746ae8bef0a491372eaf464fe277aa2e320c63' 
  AND (
    token = '9tG6Kywcdym3U3PfeExrw7G9zE+vofzf31enyYvwM18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038