UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nNcT0nOLInhcy8AT7T/Wr/CRn8aWa1F6oFsnugtShT0=' 
WHERE 
  key_id = '8c4b2d034122a651a09c171c56805c242be3e0fd5dc3e478398718e56e527b8d' 
  AND (
    token = 'nNcT0nOLInhcy8AT7T/Wr/CRn8aWa1F6oFsnugtShT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030