UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OqQbr2qTf/6pBNQhpt47cDb9L0Ola+UoHUIpAszvoxA=' 
WHERE 
  key_id = '66587b2e3f014b126afd799ad3792de00e04efd20a052bb41bf388406e285295' 
  AND (
    token = 'OqQbr2qTf/6pBNQhpt47cDb9L0Ola+UoHUIpAszvoxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040