UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eMem1UxTX/u2iDiX/C/U0fDcdDCVXha+0RdD+6SxY3Q=' 
WHERE 
  key_id = '90f35c70372f15dee90a116e0b26a8c28fd42945440a5124762c5eb54d8f25ad' 
  AND (
    token = 'eMem1UxTX/u2iDiX/C/U0fDcdDCVXha+0RdD+6SxY3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038