UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nhM35i+t163Kh1zbZ7pBaT4kF2tWLgM4eG2beXTYGMU=' 
WHERE 
  key_id = '9c30ee4903cecb97da79e11130dae83eb840ec428fe3a591f9c903f3e690689f' 
  AND (
    token = 'nhM35i+t163Kh1zbZ7pBaT4kF2tWLgM4eG2beXTYGMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023